<template>
  <div class="table-page-search-wrapper">
    <el-form :model="searchForm" ref="searchForm" label-width="100px" class="demo-ruleForm">
      <el-row :gutter="10">
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="手机号:">
            <el-input v-model="searchForm.phoneNum" placeholder="请输入会员手机号" />
          </el-form-item>
        </el-col>
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="注册渠道:">
            <el-select v-model="searchForm.registerChannel" placeholder="请选择注册渠道" style="width:100%">
              <el-option
                v-for="item in statuslistt"
                :key="item.value"
                :value="item.value"
                :label="item.label"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="注册时间:">
            <el-date-picker
              v-model="searchForm.registerTime"
               type="datetime"
               :default-time="['00:00:00', '23:59:59']"
              placeholder="选择日期时间"
            ></el-date-picker>
          </el-form-item>
        </el-col> -->
        <el-col :md="8" :sm="12" :xs="24">
          <el-form-item label="注册时间:">
            <el-date-picker
              v-model="registerTime"
              type="datetimerange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              style="width:100%"
              @change="zdsjChange"
               :default-time="['00:00:00', '23:59:59']"
            >></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="会员等级:">
            <el-select v-model="searchForm.gradeId" placeholder="请选择会员等级" style="width:100%">
              <el-option
                v-for="item in hydjList"
                :key="item.value"
                :value="item.value"
                :label="item.label"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <el-form-item label="注册门店:">
            <el-input v-model="searchForm.shopName" placeholder="请输入门店名称" />
          </el-form-item>
        </el-col>
        <el-col :md="8" :sm="12" :xs="24" style="padding:0 8px;">
          <div style="margin-left:30px">
            <el-button type="primary" icon="el-icon-search" @click="searchAction()">查询</el-button>
            <el-button icon="el-icon-refresh" @click="resetSearch()" style="margin-left: 8px;">重置</el-button>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
import { persongradefetchList } from "@/api/shop/member/level.js";
export default {
  name: "search",
  data() {
    return {
      statuslistt: [
        {
          label: "线下",
          value: "00"
        },
        {
          label: "线上",
          value: "01"
        }
      ], //注册渠道
      hydjList: [

      ], //会员等级
      searchForm: {},
      registerTime:[]
    };
  },
  mounted() {
    this.hydjListFn();
  },
  methods: {
    searchAction() {
      //执行搜索
      this.$emit("search");
    },
    resetSearch() {
      this.searchForm = {};
      this.registerTime = []
      this.$emit("resetSearch");
    },
    getSearchForm() {
      //获取高级搜索条件
      return {
        ...this.searchForm
      };
    },
    hydjListFn() {
      persongradefetchList().then(val => {
        console.log(val);
        let data = val.data.data.records;
        this.hydjList = data.map(item => {
          return {
            label: item.gradeName,
            value: item.gradeId
          };
        });
      });
    },
    zdsjChange(e) {
      this.searchForm.beginTime = this.formDate(e[0]);
      this.searchForm.endTime = this.formDate(e[1]);
    },
  }
};
</script>


<style lang="less">
</style>>
